package com.smartpro.mis.modular.system.dao;

import com.smartpro.mis.modular.business.neo4jEntity.N4jProduct;
import com.smartpro.mis.modular.business.neo4jEntity.N4jUser;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.Collection;

/**
 * @author Michael Hunger
 * @author Mark Angrish
 * @author Michael J. Simons
 */
@RepositoryRestResource(collectionResourceRel = "n4jProduct", path = "n4jProduct")
public interface N4jProductRepository extends Neo4jRepository<N4jProduct, Long> {

	N4jProduct findByProductID(@Param("productID") int productID);


    @Query("MATCH (m:N4jProduct)<-[r:BUY_NOT_PAY]-(a:N4jUser) RETURN m,r,a LIMIT {limit}")
	Collection<N4jProduct> graph(@Param("limit") int limit);
}